import React, { Component } from 'react'
import './index.less';
import { Button } from 'antd';
// import utils from '@/utils/utils'

import history from '@/history';



class Error extends Component {
  constructor(props) {
    super(props);
    this.state = {
      showLogin: false,
      showRegister: false,
      type: 1
    }

    this.reLoad = this.reLoad.bind(this);
    this.goIndex = this.goIndex.bind(this);

  }

  componentDidMount() {
    //监听登录状态

    // let urlGet = utils.GetRequest();
    // // console.log(urlGet);
    // let Urltype = urlGet['errorType'] ? urlGet['errorType'] - 0 : 0 - 0;
    // // console.log(Urltype);
    // this.setState({
    //   // type: Urltype
    // })



  }

  reLoad() {
    window.location.reload(true)
  }
  goIndex() {
    history.push({
      // pathname: '/Contents/pages/BCard/index.html/index',
      pathname: 'index',
      search: '?link=error'
    })
  }


  render() {
    return (
      <div>
        <div className="error-box">
          {
            this.state.type === 0 &&
            <div className='error_item error_item_0'>
              <img src='//nnfw.jss.com.cn/51B570A90B72469DBFF97546E671A553/error1.png' alt="" />
              <p>网络连接失败，请检查你的网络~</p>
            </div>
          }
          {
            this.state.type === 1 &&
            <div className='error_item error_item_1'>
              <img src='//nnfw.jss.com.cn/41C56591BB3C4FA784E83CEA29976F51/error2.png' alt="" />
              <p className='title'>抱歉！您指定的页面暂时无法访问~</p>
              <p>您要访问的页面内容可能已被删除，名称已被更改或暂时无权限访问</p>

              <Button ghost type='primary' onClick={this.reLoad}>刷新页面</Button>
              <span className='shim12'></span>
              <Button type='primary' onClick={this.goIndex}>去首页逛逛</Button>
            </div>
          }
        </div>
      </div>
    )
  }
}

export default Error